<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <h1 class="m-n font-thin h3 text-black">服务器组</h1>
                    <small class="text-muted">服务器组维护</small>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->
            <uib-tabset>
                <uib-tab index="0" heading="日志服务配置">
                    <div ng-controller="logServiceGroupManageCtrl">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <form class="form-inline" role="form">
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">Project</span>
                                            <input type="text" class="form-control" ng-model="queryProjectName"
                                                   placeholder="Project名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">Logstore</span>
                                            <input type="text" class="form-control" ng-model="queryLogstoreName"
                                                   placeholder="Logstore名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <button type="button" class="btn btn-info" ng-click="doQuery()"><span
                                                class="glyphicon glyphicon-search"></span>搜索
                                        </button>
                                        <button type="button" class="btn btn-info" ng-click="reSet()"><span
                                                class="glyphicon glyphicon-repeat"></span>重置
                                        </button>
                                        <!--ng-if="contains(authPoint, '/servergroup/update')"-->
                                        <button type="button" class="btn btn-success" ng-click="addLSGroup()"><span
                                                class="glyphicon glyphicon-plus"></span>新增
                                        </button>
                                    </div>
                                </form>
                                <div style="margin-top: 5px;">
                                    <table class="table table-hover table-bordered table-striped">
                                        <thead>
                                        <tr>
                                            <td>Project</td>
                                            <td>Logstore</td>
                                            <td>Config</td>
                                            <td class="col-md-6">成员(服务器组)</td>
                                            <td class="col-md-2">操作</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr ng-repeat="item in pageData">
                                            <td>
                                                <b style="color: #286090" class="pull-left">{{item.project}}</b>
                                            </td>
                                            <td>
                                                {{item.logstore}}
                                            </td>
                                            <td>
                                                {{item.config}}
                                            </td>
                                            <td>
                                                <div class="col-md-4" ng-repeat="member in item.memberList">
                                                    <b style="margin-left: 5px; color: #286090">
                                                        {{member.serverGroupName}}</b>
                                                </div>
                                            </td>
                                            <td>
                                                <button ng-click="editLSGroup(item)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-edit"></span>编辑
                                                </button>
                                                <button ng-click="pushGroupCfg(item.id)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #20a03f; color: white;">
                                                    <span class="glyphicon glyphicon-play"></span>推送
                                                </button>

                                                <!--<button class="btn btn-xs" ng-show="workflowTodo.todoStatus == 0 && workflowTodo.todoPhase == 0"-->
                                                        <!--style="margin-right: 25px; background-color: green; color: white;"-->
                                                        <!--ng-click="saveTodo()">-->
                                                    <!--<i class="fa fa-spin fa-spinner" ng-show="btnSaveing"></i>-->
                                                    <!--<i class="glyphicon glyphicon-ok" ng-show="!btnSaveing"></i>保存-->
                                                <!--</button>-->
                                            </td>
                                        </tr>
                                        </tbody>
                                        <tfoot>
                                        <tr>
                                            <td colspan="6">
                                                <ul style="margin: 0px; float: right;" uib-pagination
                                                    total-items="totalItems" ng-model="currentPage"
                                                    items-per-page="pageLength" max-size="10" ng-change="pageChanged()"
                                                    previous-text="&lsaquo;" next-text="&rsaquo;"></ul>
                                            </td>
                                        </tr>
                                        </tfoot>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </uib-tab>
                <uib-tab index="1" heading="服务器组独立配置">
                    <div ng-controller="logServiceManageCtrl">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <form class="form-inline" role="form">
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">名称</span>
                                            <input type="text" class="form-control" ng-model="queryName"
                                                   placeholder="名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">使用类型</span>
                                            <select class="form-control" ng-model="nowType"
                                                    ng-options="type.useType as type.typeName for type in useType">
                                                <option value="">--请选择--</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <button type="button" class="btn btn-info" ng-click="doQuery()"><span
                                                class="glyphicon glyphicon-search"></span>搜索
                                        </button>
                                        <button type="button" class="btn btn-info" ng-click="reSet()"><span
                                                class="glyphicon glyphicon-repeat"></span>重置
                                        </button>
                                        <button type="button" class="btn btn-success" ng-click="addServerGroup()"
                                                ng-if="contains(authPoint, '/servergroup/update')"><span
                                                class="glyphicon glyphicon-plus"></span>新增
                                        </button>
                                    </div>
                                </form>
                                <div style="margin-top: 5px;">
                                    <table class="table table-hover table-bordered table-striped">
                                        <thead>
                                        <tr>
                                            <td>服务器组</td>
                                            <td class="col-md-1">使用类型</td>
                                            <td class="col-md-2">Project</td>
                                            <td class="col-md-2">Logstore</td>
                                            <td class="col-md-2">Topic</td>
                                            <td>操作</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr ng-repeat="item in pageData">
                                            <td>
                                                <b style="color: #286090"
                                                   class="pull-left">{{item.serverGroupDO.name}}</b>
                                                <b style="color: #777"
                                                   class="pull-right">{{item.serverGroupDO.content}}</b>
                                            </td>
                                            <td>
                                                <b style="color:{{item.serverGroupUseTypeDO.color}} ">{{item.serverGroupUseTypeDO.typeName}}</b>
                                            </td>
                                            <td>
                                                <b style="color: #286090" class="pull-left">{{item.project}}</b>
                                            </td>
                                            <td>
                                                <b style="color: #286090" class="pull-left">{{item.logstore}}</b>
                                            </td>
                                            <td>
                                                <b style="color: #286090" class="pull-left">{{item.topic}}</b>
                                            </td>
                                            <td>
                                                <button ng-click="editMachineGroup(item)"
                                                        class="btn btn-xs"
                                                        style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                    <span class="glyphicon glyphicon-edit"></span>编辑
                                                </button>
                                            </td>
                                        </tr>
                                        </tbody>
                                        <tfoot>
                                        <tr>
                                            <td colspan="6">
                                                <ul style="margin: 0px; float: right;" uib-pagination
                                                    total-items="totalItems" ng-model="currentPage"
                                                    items-per-page="pageLength" max-size="10" ng-change="pageChanged()"
                                                    previous-text="&lsaquo;" next-text="&rsaquo;"></ul>
                                            </td>
                                        </tr>
                                        </tfoot>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </uib-tab>
            </uib-tabset>
        </div>
    </div>
    <!-- / main -->
</div>


<script type="text/ng-template" id="groupInfo">
    <div ng-include="'tpl/modal/aliyun/aliyun_logservice_group_info_modal.html'"></div>
</script>



<script type="text/ng-template" id="machineGroupInfo">
    <div ng-include="'tpl/modal/aliyun/aliyun_logservice_machinegroup_info_modal.html'"></div>
</script>
